package com.woniuxy.cloud;

import com.woniu.cloud.common.dto.Result;
import com.woniuxy.cloud.form.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import javax.annotation.Resource;
import java.io.IOException;
import java.sql.ResultSet;
import java.text.ParseException;

/**
 * @description:
 * @author: ZXG
 * @time: 2021/9/22
 */


@FeignClient(value = "user",contextId = "UserAPI")
public interface UserAPI {


        /**
         * 根据用户id查看积分
         * @param userId 用户id
         * @return Result
         **/
        @GetMapping("/getScoreByUserId")
        public Result getScoreByUserId(@RequestParam("userId") Integer userId);

        /**
         * 通过账号或手机号手机号获取验证短信
         * @param userName  用户名
         * @param userPhone 手机号
         * @return Result
         **/
        @GetMapping("/getUpdateMessage")
        public Result getUpdateMessage(@RequestParam("userName") String userName, @RequestParam("userPhone") String userPhone);


        /**
         * 输入验证码 修改密码
         * @param code      验证码
         * @param newPassWord 新密码
         * @return Result
         **/
        @PutMapping("/updatePassWord")
        public Result updatePassWord(@RequestParam("code") String code, @RequestParam("newPassWord") String newPassWord);


        /**
         * 获取登录验证码
         * @param userName  用户名
         * @param userPhone 手机号
         * @return Result
         **/
        @GetMapping("/getLoginMessage")
        public Result getLoginMessage(@RequestParam("userName") String userName, @RequestParam("userPhone") String userPhone);


        /**
         * 通过手机号手机号 短信验证码登录
         * @param userPhone 手机号
         * @param code    验证码
         * @return Result
         **/
        @GetMapping("/loginByUserPhone")
        public Result loginByUserPhone(@RequestParam("userPhone") String userPhone,@RequestParam("code") String code);


        /**
         * 通过账号或手机号和密码登录
         * @param userName  用户名
         * @param userPhone 手机号
         * @param passWord  密码
         * @return Result
         **/
        @GetMapping("/login")
        public Result login(@RequestParam("userName") String userName, @RequestParam("userPhone") String userPhone, @RequestParam("passWord") String passWord);


        /**
         * 注销登录
         * @return Result
         **/
        @PutMapping("/cancellation")
        public Result cancellation();


        /**
         * 获取注册验证码
         * @param userPhone 手机号
         * @return Result
         **/
        @GetMapping("/getRegisterMessageByUserPhone")
        public Result getRegisterMessageByUserPhone(@RequestParam("userPhone") String userPhone);


        /**
         * 验证手机号是否已经注册
         * @param phone 手机号
         * @return Result
         **/
        @GetMapping("/getTestPhone")
        public Result getTestPhone(@RequestParam("phone") String phone);


        /**
         * 注册
         * @return Result
         * @body registerForm
         **/
        @PostMapping("/register")
        public Result register(@RequestBody RegisterForm registerForm);




        /**
         * 用户领取优惠劵 用户id 优惠劵id 优惠劵数量
         * @return Result
         * @body addCouponForm
         **/
        @PostMapping("/insetCouponByUserId")
        public Result insetCouponByUserId(@RequestBody AddCouponForm addCouponForm);


        /**
         * 用户查看拥有的优惠劵
         * @param userId 用户id
         * @return Result
         **/
        @GetMapping("/getCouponsListByUserId")
        public Result getCouponsListByUserId(@RequestParam("userId") Integer userId);

        /**
         * 用户使用了优惠券 减少优惠券
         * @param couponId
         * @param num
         * @return
         */
        @PutMapping("/updateUserCouponNumByUserCouponId")
        Result updateUserCouponNumByUserCouponId(@RequestParam("userCouponId") Integer couponId,@RequestParam("num") Integer num);
        /**
         * 用户添加收货地址
         * @return Result
         * @body userAddressForm
         **/
        @PostMapping("/insertAddress")
        public Result insertAddress(@Validated @RequestBody UserAddressForm userAddressForm);


        /**
         * 用户查看收货地址列表
         * @param userId
         * @return Result
         **/
        @GetMapping("/getAddressByUserId")
        public Result getAddressByUserId(@RequestParam("userId")Integer userId);


        /**
         * 用户修改收获地址
         * @return Result
         * @body userAddressForm
         **/
        @PutMapping("/updateAddressByUserAddressId")
        public Result updateAddressByUserAddressId(@RequestBody UpdateUserAddressForm updateUserAddressForm);


        /**
         * 修改用户默认收货地址
         * @param userAddressId 用户地址id
         * @return Result
         **/
        @PutMapping("/updateDefaultAddress")
        public Result updateDefaultAddress(@RequestParam("userAddressId") Integer userAddressId);


        /**
         * 删除收货地址
         * @param userAddressId 用户地址id
         * @return Result
         **/
        @DeleteMapping("/deleteAddressByUserAddress")
        public Result deleteAddressByUserAddress(@RequestParam("userAddressId") Integer userAddressId);


    /**
     *  用户添加爱车
     *  @param useId
     * @param userCarCarSeriesId
     * @return
     */
        @PostMapping("/insetCar")
        public Result insertCar(@RequestParam("useId")Integer useId,@RequestParam("userCarCarSeriesId") Integer userCarCarSeriesId);


        /**
         * 用户移除爱车
         * @param userCarId 用户车型id
         * @return Result
         **/
        @DeleteMapping("/deleteCarByUserCarId")
        public Result deleteCarByUserCarId(@RequestParam("userCarId") Integer userCarId);


        /**
         * 用户修改默认爱车
         * @param userId
         * @param userCarId 用户车型id
         * @return Result
         **/
        @PutMapping("/updateDefaultCarByUserCarId")
        public Result updateDefaultCarByUserCarId(@RequestParam("userId") Integer userId,@RequestParam("userCarId") Integer userCarId);



        /**
         * 获取用户爱车
         * @param userId
         * @return Result
         **/
        @GetMapping("/getUserCarListByUserId")
        public Result getUserCarListByUserId(@RequestParam("userId")Integer userId);


        /**
         * 获取用户详情
         * @param userId
         * @return Result
         **/
        @GetMapping("/getUserByUserId")
        public Result getUserByUserId(@RequestParam("userId")Integer userId);

        /**
         * 钱包充值
         * @param userId 用户id
         * @param userBalance 充值余额
         * @return Result
         **/
        @PutMapping("/addUserBalanceByUserId")
        public Result addUserBalanceByUserId(@RequestParam("userId")Integer userId,@RequestParam("userBalance") Double userBalance);


        /**
         * 提现
         * @param userId 用户id
         * @param userBalance 提现余额
         * @return Result
         */
        @PutMapping("/withdraw")
        public Result withdraw(@RequestParam("userId")Integer userId,@RequestParam("userBalance") Double userBalance);


        /**
         * 余额支付
         * @param userId 用户id
         * @param  userBalance 修改的余额
         * @return Result
         **/
        @PutMapping("/updateUserBalnceByUserId")
        public Result updateUserBalnceByUserId(@RequestParam("userId")Integer userId,@RequestParam("userBalance") Double userBalance);




        /**
         * 增加用户消费金额
         * @param userId
         * @param userPayFee
         * @return
         */
        @PutMapping("/updateUserPayFeeByUserId")
        public Result updateUserPayFeeByUserId(@RequestParam("userId")Integer userId,@RequestParam("userPayFee")Double userPayFee);



        /**
         * 修改用户头像
         * @param userId 用户id
         * @param file   上传的图片
         * @return Result
         **/
        @PostMapping("/updateUserProfilePhotoByUserId")
        public Result updateUserProfilePhotoByUserId(@RequestParam("userId")Integer userId,@RequestParam("file") MultipartFile file) throws IOException;


        /**
         * 修改用户支付密码
         * @param userId
         * @param userPaymentPassWord 旧支付密码
         * @param newPassWord         新支付密码
         * @return Result
         **/
        @PutMapping("/updateUserPassWordByUserId")
        public Result updateUserPassWordByUserId(@RequestParam("userId")Integer userId,@RequestParam("userPaymentPassWord") String userPaymentPassWord, @RequestParam("newPassWord") String newPassWord);



        /**
         * 添加用户积分
         * @param userId 用户id
         * @param userScore 修改的积分数
         * @return Result
         **/
        @PutMapping("/addUserScoreByUserId")
        public Result addUserScoreByUserId(@RequestParam("userId")Integer userId, @RequestParam("userScore") Integer userScore);


        /**
         * 减少用户积分
         * @param userId 用户id
         * @param userScore 修改的积分数
         * @return Result
         **/
        @PutMapping("/reduceUserScoreByUserId")
        public Result reduceUserScoreByUserId( @RequestParam("userId")Integer userId,@RequestParam("userScore") Integer userScore);



        /**
         * 修改用户昵称
         * @param userId 用户id
         * @param newName 新昵称
         * @return Result
         **/
        @PutMapping("/updateUserNickNameByUserId")
        public Result updateUserNickNameByUserId(@RequestParam("userId")Integer userId,@RequestParam("newName") String newName);


        /**
         * 用户添加购物车
         * @body goodCar
         * @return Result
         **/
        @PostMapping("/insertGoodCar")
        public Result insertGoodCar(@RequestBody AddGoodCarForm goodCar) throws NoSuchFieldException;


        /**
         * 用户移除购物车
         * @param goodCarId 购物车id
         * @return Result
         **/
        @DeleteMapping("/deleteGoodCarByGoodCarId")
        public Result deleteGoodCarByGoodCarId(@RequestParam("goodCarId") Integer goodCarId);



        /**
         * 用户修改购物车中商品的数量
         * @param goodCarId 购物车id
         * @param goodCarNum 修改的数量
         * @return Result
         **/
        @PutMapping("/updateGoodCarNumByGoodCarId")
        public Result updateGoodCarNumByGoodCarId(@RequestParam("goodCarId") Integer goodCarId,@RequestParam("goodCarNum") Integer goodCarNum);


        /**
         * 用户获取商品购物车列表
         * @param userId
         * @return Result
         **/
        @GetMapping("/getGoodCarListByUserId")
        public Result getGoodCarListByUserId(@RequestParam("userId")Integer userId);


        /**
         * 添加服务购物车
         * @param addServiceCarForm
         * @return Result
         */
        @PostMapping("/insertServiceCar")
        public Result insertServiceCar(@RequestBody AddServiceCarForm addServiceCarForm);


        /**
         * 查询服务进度
         * @param orderDetailId 订单详情id
         * @return Result
         **/
        @GetMapping("/getUserServiceByUserServiceProcessId")
        public Result getUserServiceByUserServiceProcessId(@RequestParam("orderDetailId") Integer orderDetailId);

        @GetMapping("/getGoodCarByIds")
        Result getGoodCarByIds(@RequestParam("ids") String ids);

        @GetMapping("/getServiceCarByIds")
        Result getServiceCarByIds(@RequestParam("ids") List<Integer> ids);

        /**
         * 修改用户服务进度状态为开始
         * @param userServiceProcessId 服务流程id
         * @return Result
         **/
        @PutMapping("/updateUserServiceStartByUserServiceProcessId")
        public Result updateUserServiceStartByUserServiceProcessId(@RequestParam("userServiceProcessId") Integer userServiceProcessId);

        /**
         * 修改用户服务流程状态为结束
         * @param userServiceProcessId 服务流程id
         * @return
         */
        @PutMapping("/updateUserServiceOverByUserServiceProcessId")
        public Result updateUserServiceOverByUserServiceProcessId(@RequestParam("userServiceProcessId") Integer userServiceProcessId) throws ParseException;


        /**
         * 移除服务购物车
         * @param serviceCarId 服务购物车id
         * @return Result
         */
        @DeleteMapping("/deleteServiceCarByServiceCarId")
        public Result deleteServiceCarByServiceCarId(@RequestParam("serviceCarId")Integer serviceCarId);


        /**
         * 修改服务购物车数量
         * @param serviceCarId 服务购物车id
         * @param serviceCarNum 服务购物车数量
         * @return Result
         */
        @PutMapping("/updateServiceCarNumByServiceCarId")
        public Result updateServiceCarNumByServiceCarId(@RequestParam("serviceCarId") Integer serviceCarId,@RequestParam("serviceCarNum") Integer serviceCarNum);


        /**
         * 根据用户id获取服务购物车列表
         * @param userId
         * @return
         */
        @GetMapping("/getServiceCarListByUserId")
        public Result getServiceCarListByUserId(@RequestParam("userId")Integer userId);


        /**
         * 生成用户服务流程记录
         * @param addUserServiceProcessForm
         * @return Result
         **/
        @PostMapping("/createUserServiceProcess")
        public Result createUserServiceProcess(@Validated @RequestBody AddUserServiceProcessForm addUserServiceProcessForm);



        /**
         * 冻结账户
         * @param addUserBlackForm
         * @return Result
         */
        @PostMapping("/insertUserBlack")
        public  Result insertUserBlack(@Validated @RequestBody  AddUserBlackForm addUserBlackForm);

        @GetMapping("/getUserCouponById")
        public Result getUserCouponById(@RequestParam("id") Integer id);





}
